package top.saplf.sileny.player.home

import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import top.saplf.sileny.ext.PoKo

/**
 * @author saplf
 */

@PoKo data class Music(
        @PrimaryKey var id: String,
        var name: String,
        var path: String,
        var valid: Boolean,
        var author: String,
        var album: String,
        var cover: String,
        var lrc: String? = null
): RealmObject() {
    override fun equals(other: Any?): Boolean {
        return other is Music && other.id == id
    }

    override fun hashCode(): Int {
        var result = id.hashCode()
        result = 31 * result + name.hashCode()
        result = 31 * result + path.hashCode()
        result = 31 * result + valid.hashCode()
        result = 31 * result + author.hashCode()
        result = 31 * result + album.hashCode()
        result = 31 * result + cover.hashCode()
        return result
    }
}
